#pragma once
#include <memory>
#include <functional>
#include <string>


#include "Acceptor.h"
#include "EventLoop.h"


class TcpConnection;


using TcpConnectionPtr = std::shared_ptr<TcpConnection>;
using TcpConnectionCallback = std::function<void(const TcpConnectionPtr &)>;

class TcpServer{
private:
    Acceptor _acceptor;
    EventLoop _loop;

public:
    TcpServer(const std::string& ip,unsigned short port);
    ~TcpServer();
    void start();
    void stop();
    void setAllCallback(TcpConnectionCallback&& newConnectionCallback,
                                  TcpConnectionCallback&& messageCallback,
                                  TcpConnectionCallback&& closeCallback);

};